<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态绑定通信组件</title>
    <script src="/vue.js"></script>
</head>
<body>
    <div id="app">
    <!-- 创建文本框，绑定message -->
    <input type="text" v-model="message">
    <!-- v-bind动态绑定message -->
    <child v-bind:title="message"></child>
    </div>
    <script>
        //注册，声明一个child的组件
        Vue.component("child",{
            //声明props
            props:["title"],
            data(){
                return{

                }
            },
            template:`<h1>{{title}}</h1>`
        })

        new Vue({
            el:'#app',
            data(){
                return{
                     message:"这是来自Vue实例的data数据"
                }
            }
        })
    </script>
</body>
</html>